<script language="javascript">
function OpenTree( url )
{
	var winwidth = ( screen.width * .8);
	var winheight = ( screen.height * .8);
	var iLeft = ( screen.width  - winwidth ) / 2 ;
	var iTop  = ( screen.height - winheight ) / 2 ;

	var sOptions = "toolbar=no,status=yes,resizable=yes,dependent=yes,scrollbars=1" ;
	sOptions += ",width=" + winwidth ;
	sOptions += ",height=" + winheight ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	window.open( url, 'FileBrowserWindow', sOptions ) ;
}
</script>
<!---setup some variables for pagination--->
<cfparam name = "start" default="1">
<cfparam name = "disp" default="50">
<cfparam name = "end" default="999">
<cfparam name = "page" default="1">
<cfparam name = "sortby" default = "firstname">
<cfparam name = "sortorder" default = "ASC">
<cfparam name = "updateid" default = "0">
<cfparam name = "viewgroup" default = "All">
<cfparam name = "searchbox" default = "">
<cfparam name = "viewtype" default="1">
<cfset startsql = start - 1>

<cfinvoke component="cfcs.account" method="getusers" start="#start#" sorby="#sortby#" sortorder="#sortorder#" viewgroup="#viewgroup#" viewtype="#viewtype#" searchbox="#searchbox#" returnvariable="qaccounts" />
<cfinvoke component="cfcs.account" method="getusercount" start="#start#" sorby="#sortby#" sortorder="#sortorder#" viewgroup="#viewgroup#" viewtype="#viewtype#" searchbox="#searchbox#" returnvariable="totalrecords" />

<table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr>
      <td width="25%" valign="top">
		<cfoutput>#request.lang.accounts.accounts.totalmsg#:
		  #totalrecords#</cfoutput></td>
      <td valign="top">
      </td>
    <td width="35%" valign="top" with="25%"></td>
  </tr>
  <cfif disp LT totalrecords>
  <tr>
  	<td colspan="3">
        <cfinvoke component="cfcs.common.paginate" method="show" start="#start#" disp="#disp#" totalrecords="#totalrecords#" page="#page#" url="index.cfm?c=accounts&a=default" maxset="12" />    
    </td>
  </tr>
  </cfif>
  <tr>
    <td colspan="2" valign="top">
    <form id="form1" name="form1" method="post" action="index.cfm?c=accounts">
        <cfoutput>#request.lang.accounts.labels.sort#</cfoutput>:
        <select name="sortby" onchange="this.form.submit();">
          <option value="lastname" <cfif sortby IS 'lastname'>SELECTED</cfif>>Last Name</option>
          <option value="firstname" <cfif sortby IS 'firstname'>SELECTED</cfif>>First Name</option>
          <option value="email" <cfif sortby IS 'email'>SELECTED</cfif>>Email Address</option>
          <option value="city" <cfif sortby IS 'city'>SELECTED</cfif>>City</option>
          <option value="state" <cfif sortby IS 'state'>SELECTED</cfif>>State</option>
          <option value="sales" <cfif sortby IS 'sales'>SELECTED</cfif>>Number of Sales</option>
          <option value="aid" <cfif sortby IS 'aid'>SELECTED</cfif>>Account ID</option>
        </select>
        <select name="sortorder" onchange="this.form.submit();">
          <option value="ASC" <cfif sortorder IS 'ASC'>SELECTED</cfif>>Ascending</option>
          <option value="DESC" <cfif sortorder IS 'DESC'>SELECTED</cfif>>Descending</option>
        </select>
        <cfoutput>
        <input type = "hidden" name = "start" value="#start#">
        <input type = "hidden" name = "disp" value="#disp#">
        <input type = "hidden" name = "viewgroup" value="#viewgroup#">
        <input type = "hidden" name = "searchbox" value="#searchbox#">
        <input type = "hidden" name = "viewtype" value="#viewtype#">
        </cfoutput>
      </form></td>
    <td width="45%" align="left" valign="top"><form id="form1" name="form1" method="post" action="index.cfm?c=accounts">
        <div align="right"><cfoutput>#request.lang.accounts.labels.search#</cfoutput>:
          <cfoutput>
          <input name="searchbox" type="text" id="searchbox" size="20" value="#searchbox#" onclick="this.focus(); this.select();" />
          <input type="submit" name="Submit" value="Submit" id="abutton" />
          <input type = "hidden" name = "viewtype" value="#viewtype#">
          <input type = "hidden" name = "sortby" value="#sortby#">
          <input type = "hidden" name = "sortorder" value="#sortorder#">
          <input type = "hidden" name = "disp" value="#disp#">
          <input type = "hidden" name = "viewgroup" value="#viewgroup#">
          </cfoutput>
        </div>
      </form></td>
  </tr>
</table>
<!---Header row--->
<table width="100%" border="0" cellspacing="0" cellpadding="6">
  <cfoutput>
  <tr>
    <td width="5%" id="columnheaders">#request.lang.accounts.accounts.col0#</td>
    <td width="15%" id="columnheaders">#request.lang.accounts.accounts.col1#</td>
    <td id="columnheaders" width="15%">#request.lang.accounts.accounts.col2#</td>
    <td id="columnheaders" width="10%" align="left">#request.lang.accounts.accounts.col3#</td>
    <td id="columnheaders" width="5%" align="left">#request.lang.accounts.accounts.col4#</td>
    <td id="columnheaders" width="10%">#request.lang.accounts.accounts.col5#</td>
    <td id="columnheaders"><div align="center">#request.lang.accounts.accounts.col6#</div></td>
    <td id="columnheaders" width="20%"></td>
  </tr>
  </cfoutput>
  <!---data--->
  <form name = "mbrTable" <cfoutput>action="index.cfm?c=accounts&a=delete"</cfoutput> method="post">
    <cfloop query = "qaccounts">
    <cfoutput>
    <tr class="menu_row" onMouseDown="this.className = 'menu_row_over';" onmouseover = "this.className = 'menu_row_over2';" onMouseUp="this.className = 'menu_row_over';" onmouseout = "this.className = 'menu_row';">
      <td class="menu_cell">
      	<!---active/inactive toggle--->
        <div align="center">
        <cfdiv id="fdiv_#id#">
          <cfif account_status IS 1>
            <img src="images/activeon.png" alt="#request.lang.defaults.tooltip_on2#" width="28" title="#request.lang.defaults.tooltip_on2#" onclick="deactivate('#id#', 'fdiv_#id#');">
            <cfelse>
             <img src="images/activeoff.png" alt="#request.lang.defaults.tooltip_off2#" width="28" title="#request.lang.defaults.tooltip_off2#" id="fimg#id#" onclick="activate('#id#', 'fdiv_#id#');">
          </cfif>
        </cfdiv>        
        </div>
        <!---end toggle--->
      </td>
      <td nowrap="nowrap" class="menu_cell" onclick="window.location.href = 'index.cfm?c=accounts&a=Edit&amp;id=#id#&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#';" >#firstname# #lastname#
        &nbsp;</td>
      <td nowrap="nowrap" class="menu_cell"><a href = "mailto: #email#">#email#</a>
        <cfif updateid IS #id#>
          <font color="##FF0000">Updated</font>
        </cfif>
        &nbsp;</td>
      <td nowrap="nowrap" class="menu_cell" onclick="window.location.href = 'index.cfm?c=accounts&a=edit&amp;id=#id#&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#';">#city#
        &nbsp;</td>
      <td nowrap="nowrap" class="menu_cell" onclick="window.location.href = 'index.cfm?c=accounts&a=edit&amp;id=#id#&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#';">#state#
        &nbsp;</td>
      <td class="menu_cell" onclick="window.location.href = 'index.cfm?c=accounts&a=edit&amp;id=#id#&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#';">#username#</td>
      <td class="menu_cell" onclick="window.location.href = 'index.cfm?c=accounts&a=edit&amp;id=#id#&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#';"><div align="center">
          #aid#
        </div></td>
      <td class="menu_cell">
        <div align="center">
        <a href="index.cfm?c=accounts&a=Edit&amp;id=#id#&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#"><img src="images/edit.png" border="0" title="#request.lang.defaults.tooltip_edit#" alt="#request.lang.defaults.tooltip_edit#" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
        <img src="images/delete.png" border="0" onclick="confirmdeleteaccount('#id#', '&disp=#disp#&start=#start#&searchbox=#searchbox#&sortby=#sortby#&sortorder=#sortorder#&viewtype=#viewtype#');" style="cursor: pointer;" title="#request.lang.defaults.tooltip_del#" alt="#request.lang.defaults.tooltip_del#" />&nbsp;&nbsp;&nbsp;&nbsp;
        <a href = "index.cfm?c=accounts&a=downloads&user=#username#"><img src="images/icons/downloads.png" border="0" title="#request.lang.defaults.tooltip_downloads#" alt="#request.lang.defaults.tooltip_downloads#" /></a></div>
        </td>
    </tr>
    </cfoutput>
    </cfloop>
  </form>
</table>
<cfif qaccounts.recordcount IS 0>
  No members found!
</cfif>
